package message;

import entity.ChessUser;
import socket.ChessServer;

/**
 * 发送消息报文.
 *
 * @author 张紘溢
 */
public class ClickChatMessage extends BaseMessage {
    private String str;
    private ChessUser chessUser;

    public ClickChatMessage(String str, ChessUser chessUser) {
        this.str = str;
        this.chessUser = chessUser;
    }

    @Override
    public void sendToServer() {
        ServerGroupChat serverGroupChat = new ServerGroupChat(chessUser.getName() + " : " + str);
        //向所有人发送
        ChessServer.getInstance().sendMsgToAll(serverGroupChat);
    }

    @Override
    public void selfExecute() {

    }
}
